package com.hr.mapper;

import com.hr.domain.po.UserLoginLog;
import com.hr.domain.query.LoginLogPageParams;
import com.hr.domain.vo.UserLoginLogVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author 86150
* @description 针对表【user_login_log(用户登录日志表)】的数据库操作Mapper
* @createDate 2025-10-20 14:22:00
* @Entity com.hr.domain.po.UserLoginLog
*/
@Mapper
public interface UserLoginLogMapper {

    /**
     * 获取用户登录日志列表
     * @param queryParams
     * @return userLoginLogList
     */
    List<UserLoginLogVO> getUserLoginLogPageList(LoginLogPageParams queryParams);

    /**
     * 删除用户登录日志
     * @param logId
     * @return
     */
    @Delete("delete from user_login_log where id = #{logId}")
    int deleteLoginLog(@Param("logId") Long logId);

    /**
     * 批量删除用户登录日志
     * @param logIds
     * @return
     */
    int deleteLoginLogBatch(@Param("logIds") List<Long> logIds);

    /**
     * 新增用户登录日志
     * @param userLoginLog
     */
    @Insert("insert into user_login_log(user_id,token,login_time,expires_at,logout_time,login_source) " +
        "values(#{userId},#{token},#{loginTime},#{expiresAt},#{logoutTime},#{loginSource})")
    void addUserLoginLog(UserLoginLog userLoginLog);
}




